//
// Created by yhy on 17-7-16.
//

#ifndef PROJECT_MYREACTORSERVER_H
#define PROJECT_MYREACTORSERVER_H


#include <cstdint>
#include <Poco/Thread.h>
#include "MyHandler.h"

class MyReactorServer {
public:
    MyReactorServer() = default;

    ~MyReactorServer() = default;

    void start();

    void stop();

public:
    uint16_t getTimeout() const;

    void setTimeout(uint16_t timeout);

    uint16_t getPort() const;

    void setPort(uint16_t _port);

private:

    Poco::Thread thread;           // 起一个线程去运行 reactor

    class ReactorRun : public Poco::Runnable {
    public:
        ReactorRun() = default;

        ~ReactorRun() = default;

        void run() override;

    public:
        uint16_t timeout;               //reactor 的超时时间
        uint16_t port;
        MyReactor reactor;    // reactor.
    } reactorRun;

};


#endif //PROJECT_MYREACTORSERVER_H
